<?php
namespace app\common\model;

use think\Model;

/**  YSF
 *   常见问题分类 模型
 *   Date: 2019/3/5
 * Class CommonProblemTypeModel
 * @package app\common\model
 */
class CommonProblemTypeModel extends Model
{
    // 表名
    protected $name = 'common_problem_type';

    // 列表查询
    public function getAll($where=[],$field='*',$page=1,$pageSize=9999,$order='')
    {
        $result = $this->where($where)
            ->field($field)
            ->page($page, $pageSize)
            ->order($order)
            ->select();
        return $result;
    }

    // 数量查询
    public function getCount($where=[])
    {
        $result = $this->where($where)->count();
        return $result;
    }

    // 单条查询
    public function getOne($where=[],$field='*')
    {
        $result = $this->where($where)->field($field)->find();
        return $result;
    }

    // 添加操作
    public function add($data=[])
    {
        $result = $this->insertGetId($data);
        return $result;
    }

    // 编辑操作
    public function edit($where=[],$data=[])
    {
        $result = $this->where($where)->update($data);
        return $result;
    }

    // 删除操作
    public function delete($where=[])
    {
        $result = $this->where($where)->delete();
        return $result;
    }












}